function wordBreak(value) {
  const chars = value.split("");
  let result = "";

  for (var i = 0, len = chars.length; i < len; i++) {
    result += chars[i];

    if ((i + 1) % 5 === 0) {
      result += "\n";
    }
  }

  return result;
}

export default [
  {
    inline: false,
    title: "2022年1-12月——2023年1-6月上海市与商务区税收收入对比",
    style: "height: 400rpx",
    options: {
      tooltip: {},
      legend: {
        top: "0%",
        right: "center",
        align: "left",
        icon: "rect",
        itemWidth: 7,
        itemHeight: 7,
        textStyle: {
          color: "#999999",
        },
      },
      grid: {
        left: "3%",
        right: "3%",
        top: "20%",
        bottom: "0%",
        containLabel: true,
      },
      xAxis: {
        type: "category",
        axisTick: {
          show: false,
        },
        axisLabel: {
          interval: 0,
          formatter: wordBreak,
        },
        data: ["2022年1-12", "2023年1-2", "1-3", "1-4", "1-5", "1-6"],
      },
      yAxis: {
        type: "value",
        max: 80,
      },
      series: [
        {
          name: "商务区",
          type: "bar",
          barWidth: 15,
          color: "#14c0d4",
          data: [40, 40, 40, 40, 40, 40],
        },
        {
          name: "上海市",
          type: "bar",
          barWidth: 15,
          color: "#0b82de",
          data: [55, 55, 55, 55, 55, 55],
        },
      ],
    },
  },

  {
    style: "height: 400rpx",
    options: {
      tooltip: {},
      legend: {
        top: "0%",
        right: "center",
        align: "left",
        icon: "rect",
        itemWidth: 7,
        itemHeight: 7,
        textStyle: {
          color: "#999999",
        },
      },
      grid: {
        left: "3%",
        right: "3%",
        top: "20%",
        bottom: "0%",
        containLabel: true,
      },
      xAxis: {
        type: "category",
        axisTick: {
          show: false,
        },
        axisLabel: {
          interval: 0,
          formatter: wordBreak,
        },
        data: ["2022年1-12", "2023年1-2", "1-3", "1-4", "1-5", "1-6"],
      },
      yAxis: {
        type: "value",
        max: 80,
      },
      series: [
        {
          name: "商务区",
          type: "line",
          color: "#14c0d4",
          lineStyle: {
            width: 1,
          },
          data: [40, 40, 40, 40, 40, 40],
        },
        {
          name: "上海市",
          type: "line",
          color: "#0b82de",
          lineStyle: {
            width: 1,
          },
          data: [55, 55, 55, 55, 55, 55],
        },
      ],
    },
  },

  {
    inline: false,
    title: "2022年1月——2023年月上海市与商务区税收收入对比数",
    style: "height: 400rpx",
    options: {
      tooltip: {},
      legend: {
        top: "0%",
        right: "center",
        align: "left",
        icon: "rect",
        itemWidth: 7,
        itemHeight: 7,
        textStyle: {
          color: "#999999",
        },
      },
      grid: {
        left: "3%",
        right: "3%",
        top: "20%",
        bottom: "0%",
        containLabel: true,
      },
      xAxis: {
        type: "category",
        axisTick: {
          show: false,
        },
        axisLabel: {
          interval: 0,
          formatter: wordBreak,
        },
        data: ["2023年1月", "2月", "3月", "4月", "5月", "6月"],
      },
      yAxis: {
        type: "value",
        max: 20,
        min: -20,
      },
      series: [
        {
          name: "商务区",
          type: "bar",
          barWidth: 15,
          color: "#14c0d4",
          data: [10, 10, 10, 10, 10, 10],
        },
        {
          name: "上海市",
          type: "bar",
          barWidth: 15,
          color: "#0b82de",
          data: [-5, -15, 15, 15, 15, 15],
        },
      ],
    },
  },

  {
    inline: false,
    title: "2022年1月——2023年月上海市与商务区税收收入对比数",
    style: "height: 400rpx",
    options: {
      tooltip: {},
      legend: {
        top: "0%",
        right: "center",
        align: "left",
        icon: "rect",
        itemWidth: 7,
        itemHeight: 7,
        textStyle: {
          color: "#999999",
        },
      },
      grid: {
        left: "3%",
        right: "3%",
        top: "20%",
        bottom: "0%",
        containLabel: true,
      },
      xAxis: {
        type: "category",
        axisTick: {
          show: false,
        },
        axisLabel: {
          interval: 0,
          formatter: wordBreak,
        },
        data: ["2023年1月", "2月", "3月", "4月", "5月", "6月"],
      },
      yAxis: {
        type: "value",
        max: 20,
        min: -20,
      },
      series: [
        {
          name: "商务区",
          type: "line",
          color: "#14c0d4",
          lineStyle: {
            width: 1,
          },
          data: [10, 10, 10, 10, 10, 10],
        },
        {
          name: "上海市",
          type: "line",
          color: "#0b82de",
          lineStyle: {
            width: 1,
          },
          data: [-5, -15, 15, 15, 15, 15],
        },
      ],
    },
  },
];
